public class Test {
    public static void eat(Animal a){
        a.eat();
    }

    public static void main(String[] args) {
        Cat cat = new Cat();
        Dog dog = new Dog();
//        eat(cat);
//        eat(dog);
        Animal animal = new Cat();

        if(animal instanceof Cat){
            cat = (Cat) animal;
        }
        if (animal instanceof Dog){
            dog = (Dog) animal;
        }
    }

}
